library(DESeq2)
## Loading required package: S4Vectors
## Warning: package 'S4Vectors' was built under R version 3.6.3
## Loading required package: stats4
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, basename, cbind, colnames,
##     dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
##     grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
##     union, unique, unsplit, which, which.max, which.min
## 
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:base':
## 
##     expand.grid
## Loading required package: IRanges
## Loading required package: GenomicRanges
## Loading required package: GenomeInfoDb
## Warning: package 'GenomeInfoDb' was built under R version 3.6.3
## Loading required package: SummarizedExperiment
## Loading required package: Biobase
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## Loading required package: DelayedArray
## Warning: package 'DelayedArray' was built under R version 3.6.3
## Loading required package: matrixStats
## 
## Attaching package: 'matrixStats'
## The following objects are masked from 'package:Biobase':
## 
##     anyMissing, rowMedians
## Loading required package: BiocParallel
## 
## Attaching package: 'DelayedArray'
## The following objects are masked from 'package:matrixStats':
## 
##     colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges
## The following objects are masked from 'package:base':
## 
##     aperm, apply, rowsum
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:matrixStats':
## 
##     count
## The following object is masked from 'package:Biobase':
## 
##     combine
## The following objects are masked from 'package:GenomicRanges':
## 
##     intersect, setdiff, union
## The following object is masked from 'package:GenomeInfoDb':
## 
##     intersect
## The following objects are masked from 'package:IRanges':
## 
##     collapse, desc, intersect, setdiff, slice, union
## The following objects are masked from 'package:S4Vectors':
## 
##     first, intersect, rename, setdiff, setequal, union
## The following objects are masked from 'package:BiocGenerics':
## 
##     combine, intersect, setdiff, union
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ContrApption)
dds <- readRDS("dev/lncDESeq2Obj.Rds")
d <- counts(dds, normalized = TRUE)
d %>% head
##             AL101116_V1 AL101116_V2 AE032117_V1 AE032117_V2 NM012517_V1
## A1BG-AS1       6.461092    7.314992   5.5821144   5.0103583    7.114612
## A2M-AS1        0.000000    2.980182   2.6794149   3.2010622    2.910523
## A2ML1-AS1      0.000000    1.625554   3.1259841   2.9227090    1.293566
## A2ML1-AS2      0.000000    0.000000   0.8931383   0.2783532    0.000000
## AADACL2-AS1    5.384243    1.083703   0.4465692   2.7835324    0.000000
## AATBC         19.383276   12.462579  10.2710905  11.5516593   12.935659
##             NM012517_V2 US082217_V1 US082217_V2 IO092116_V1 IO092116_V2
## A1BG-AS1      9.8573234    4.905338   4.9548106    0.000000     0.00000
## A2M-AS1       3.0000550    5.956481   4.7070701    5.658059     0.00000
## A2ML1-AS1     2.3571860    2.102288   0.9909621    0.000000     0.00000
## A2ML1-AS2     1.2857378    1.051144   0.2477405    0.000000     0.00000
## AADACL2-AS1   0.6428689    1.051144   0.9909621   18.388693     0.00000
## AATBC        19.9289365    9.810675   9.6618807    2.829030    24.62219
##             II121416_V1 II121416_V2 NZ022317_V1 NZ022317_V2 MT031317_V1
## A1BG-AS1       5.131470    4.272065   9.7613006    5.506895   8.9124631
## A2M-AS1        3.991143    2.848043   3.0034771    4.589079   3.5649852
## A2ML1-AS1      3.420980    0.000000   0.7508693    1.376724   0.5941642
## A2ML1-AS2      1.140327    0.000000   0.0000000    1.376724   0.0000000
## AADACL2-AS1    2.850816    1.424022   2.2526078    1.376724   1.1883284
## AATBC          8.552449    1.424022  20.2734704   17.438500  25.5490609
##             MT031317_V2 AA111716_V1 AA111716_V2 OU031617_V1 OU031617_V2
## A1BG-AS1      12.125417    9.406504  25.7132723     0.00000           0
## A2M-AS1        1.212542    4.180669   0.0000000     0.00000           0
## A2ML1-AS1      0.000000    0.000000   0.0000000     0.00000           0
## A2ML1-AS2      1.212542    0.000000   0.0000000     0.00000           0
## AADACL2-AS1    3.637625    3.135501   0.0000000     0.00000           0
## AATBC         18.188126   11.496839   0.9523434     2.44878           0
##             LU041117_V1 LU041117_V2 AH060617_V1 AH060617_V2 ER121316_V1
## A1BG-AS1       5.581169    0.000000     0.00000    0.000000  12.3731326
## A2M-AS1        3.720779    0.000000     0.00000   13.096098   4.4543277
## A2ML1-AS1      0.000000    2.804077     0.00000    0.000000   0.9898506
## A2ML1-AS2      0.000000    0.000000     0.00000    0.000000   0.0000000
## AADACL2-AS1    5.581169    0.000000     0.00000    4.365366   7.4238795
## AATBC          5.581169   21.030574    64.49022   65.480490  16.8274603
##             ER121316_V2 OC012517_V1 OC012517_V2
## A1BG-AS1       4.181338    9.622995           0
## A2M-AS1        0.000000    5.498854           0
## A2ML1-AS1      0.000000    0.000000           0
## A2ML1-AS2      0.000000    0.000000           0
## AADACL2-AS1    8.362676    4.124141           0
## AATBC          8.362676   20.620704           0
annotation <- colData(dds)
annotation
## DataFrame with 28 rows and 9 columns
##                SampleID       Age      Sex       BMI  SampleName    Visit
##                <factor> <integer> <factor> <numeric>    <factor> <factor>
## AL101116_V1 AL101116_V1        83        F      20.4 AL101116_V1   Visit1
## AL101116_V2 AL101116_V2        83        F      19.7 AL101116_V2   Visit2
## AE032117_V1 AE032117_V1        74        F      25.3 AE032117_V1   Visit1
## AE032117_V2 AE032117_V2        74        F      25.1 AE032117_V2   Visit2
## NM012517_V1 NM012517_V1        65        F      21.7 NM012517_V1   Visit1
## ...                 ...       ...      ...       ...         ...      ...
## AH060617_V2 AH060617_V2        70        M      28.7 AH060617_V2   Visit2
## ER121316_V1 ER121316_V1        39        F      68.9 ER121316_V1   Visit1
## ER121316_V2 ER121316_V2        39        F        67 ER121316_V2   Visit2
## OC012517_V1 OC012517_V1        56        M      22.2 OC012517_V1   Visit1
## OC012517_V2 OC012517_V2        56        M      20.8 OC012517_V2   Visit2
##                  PID    Group        sizeFactor
##             <factor> <factor>         <numeric>
## AL101116_V1 AL101116    HFrEF 0.928635569369158
## AL101116_V2 AL101116    HFrEF   3.6910497738802
## AE032117_V1 AE032117    HFrEF  4.47858967473624
## AE032117_V2 AE032117    HFrEF  7.18511494294293
## NM012517_V1 NM012517    HFrEF  3.09222757789431
## ...              ...      ...               ...
## AH060617_V2 AH060617    HFpEF  0.22907586634865
## ER121316_V1 ER121316    HFrEF  2.02050692190161
## ER121316_V2 ER121316    HFrEF 0.239157904149093
## OC012517_V1 OC012517    HFrEF 0.727424237208874
## OC012517_V2 OC012517    HFrEF 0.314777823808078

Group

ContrApption(data = d, annotation = annotation, idCol = "SampleID", groupCol = "Group")
## Input to asJSON(keep_vec_names=TRUE) is a named vector. In a future version of jsonlite, this option will not be supported, and named vectors will be translated into arrays instead of objects. If you want JSON object output, please use a named list instead. See ?toJSON.

Visit

# need to make uuids before I can have more than one on the same page
ContrApption(data = d, annotation = annotation, idCol = "SampleID", groupCol = "Visit")
## Input to asJSON(keep_vec_names=TRUE) is a named vector. In a future version of jsonlite, this option will not be supported, and named vectors will be translated into arrays instead of objects. If you want JSON object output, please use a named list instead. See ?toJSON.

Here is some more stuff I guess?

Sure why not?